package com.alstudio.utils.mission;

import java.io.Serializable;
import java.util.ArrayList;

import com.alstudio.utils.formater.numeric.ALNumericUtils;
import com.loovee.imaohu.R;

public class MissionInfo implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = -1064168080441169838L;

	// 日常任务
	public static final int EVERYDAY_TASK = 0;
	// 新手任务
	public static final int NEW_USER_TASK = 1;
	// 初级任务
	public static final int PRIMARY_TASK = 2;
	// 中极任务
	public static final int INTERMEDIATE_TASK = 3;
	// 高级任务
	public static final int ADVANCED_TASK = 4;
	// X任务
	public static final int X_TASK = 5;

	private String title;
	// 是否锁定
	private boolean isLocked = true;
	private int id;
	private String desc;
	private String status;
	private String task_step_id;
	private String step_title;
	private String step_award_desc;
	private String addgold;
	private String addjindou;
	private String addglamour;
	private String addexp;
	private String addpoints;
	private String redirect;
	private String task_detail;
	private String task_require;
	private String task_award_desc;

	private String task_name;
	private String task_id;
	private String task_status;

	private String invite_type;
	private String invite_redirect;
	private String invite_sum;

	private boolean step_activity = false;
	// 任务详解
	private String step_task_detail;
	// 难度
	private int step_difficulty;
	public static final int STEP_GET_REWARD = 1;
	public static final int STEP_ONGOING = 2;
	public static final int STEP_DONE = 3;

	private ArrayList<MissionInvite> inviteList;
	private int complete = 0;

	private String giftId;
	private String giftName;
	private String fileId;

	public String getStepStatusText() {
		// if (!step_activity)
		// return App.ctx
		// .getString(R.string.string_system_setting_silent_peroid_off);
		// 已经激活
		String statusText = "";
		// if (step_activity) {
		// switch (getIntStatus()) {
		// case STEP_GET_REWARD:
		// // 可领取
		// statusText = App.ctx
		// .getString(R.string.string_task_status_text6);
		// break;
		// case STEP_ONGOING:
		// // 进行中
		// statusText = App.ctx
		// .getString(R.string.string_task_status_text5);
		// break;
		// case STEP_DONE:
		// // 已领取
		// statusText = App.ctx
		// .getString(R.string.string_task_status_text2);
		// break;
		// }
		//
		// }

		return statusText;
	}

	public int getStepStatusBgRes() {
		// if (!step_activity)
		// return R.drawable.use_profile_selector;

		// 已经激活
		// int res = R.drawable.icon_complete_bg;

		int res = 0;

		// switch (getIntStatus()) {
		// case STEP_GET_REWARD:
		// // 可领取
		// res = R.drawable.yellow_button_selector;
		// break;
		// case STEP_ONGOING:
		// // 进行中
		// res = R.drawable.gray_button_selector;
		// break;
		// case STEP_DONE:
		// // 已领取
		// res = R.drawable.button_default_gray_big;
		// break;
		// }
		return res;
	}

	public String getStatusText() {
		if (!step_activity) {
			return "";
		}
		String statusText = "";
		// switch (getIntStatus()) {
		// case STEP_GET_REWARD:
		// // 可领取
		// statusText = App.ctx.getString(R.string.string_task_status_text6);
		// break;
		// case STEP_ONGOING:
		// // 进行中
		// statusText = App.ctx.getString(R.string.string_task_status_text5);
		// break;
		// case STEP_DONE:
		// // 已领取
		// statusText = App.ctx.getString(R.string.string_task_status_text2);
		// break;
		// }

		return statusText;
	}

	public int getIntStatus(String s) {
		return ALNumericUtils.parseInt(s, 0);
	}

	public String getNormalMissionStatusText() {
		String statusText = "";
		// switch (getIntStatus(getTask_status())) {
		// case STEP_GET_REWARD:
		// // 可领取
		// statusText = App.ctx.getString(R.string.string_task_status_text6);
		// break;
		// case STEP_ONGOING:
		// // 进行中
		// statusText = App.ctx.getString(R.string.string_task_status_text5);
		// break;
		// case STEP_DONE:
		// // 已领取
		// statusText = App.ctx.getString(R.string.string_task_status_text2);
		// break;
		// }

		return statusText;
	}

	public String getStatusColor() {
		if (!step_activity) {
			// return MissionItemView.COLOR_GRAY;
		}
		String statusText = "";

		switch (getIntStatus()) {
		case STEP_GET_REWARD:
			// 可领取
			statusText = "#ffffff";
			break;
		case STEP_DONE:
			// 已领取
			statusText = "#ffffff";
			break;
		case STEP_ONGOING:
			// 进行中
			statusText = "#8a8a8a";
			break;
		}
		return statusText;
	}

	public int getIntStatus() {
		return ALNumericUtils.parseInt(status, 0);
	}

	public int getStstusBgRes() {
		if (!step_activity) {
			// return R.drawable.icon_complete_bg;
			return 0;
		}
		int res = 0;

		// int res = R.drawable.icon_complete_bg;
		// switch (getIntStatus()) {
		// case STEP_GET_REWARD:
		// // 可领取
		// res = R.drawable.icon_receive_bg;
		// break;
		// case STEP_ONGOING:
		// // 进行中
		// res = R.drawable.icon_conduct_bg;
		// break;
		// case STEP_DONE:
		// // 已领取
		// res = R.drawable.icon_complete_bg;
		// break;
		// }
		return res;
	}

	public int getNormalMissionStstusBgRes() {
		// int res = R.drawable.icon_complete_bg;
		int res = 0;

		// switch (getIntStatus(getTask_status())) {
		// case STEP_GET_REWARD:
		// // 可领取
		// res = R.drawable.icon_receive_bg;
		// break;
		// case STEP_ONGOING:
		// // 进行中
		// res = R.drawable.icon_conduct_bg;
		// break;
		// case STEP_DONE:
		// // 已领取
		// res = R.drawable.icon_complete_bg;
		// break;
		// }
		return res;
	}

	public int getNormalMissionStatusBgRes() {
		// int res = R.drawable.icon_complete_bg;
		int res = 0;
		// switch (getIntStatus(getTask_status())) {
		// case STEP_GET_REWARD:
		// // 可领取
		// res = R.drawable.yellow_button_selector;
		// break;
		// case STEP_ONGOING:
		// // 进行中
		// res = R.drawable.gray_button_selector;
		// break;
		// case STEP_DONE:
		// // 已领取
		// res = R.drawable.button_default_gray_big;
		// break;
		// }
		return res;
	}

	public String getNormalMissionStatusColor() {
		String statusText = "";

		switch (getIntStatus(getTask_status())) {
		case STEP_GET_REWARD:
			// 可领取
			statusText = "#ffffff";
			break;
		case STEP_DONE:
			// 已领取
			statusText = "#ffffff";
			break;
		case STEP_ONGOING:
			// 进行中
			statusText = "#8a8a8a";
			break;
		}
		return statusText;
	}

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public boolean isLocked() {
		return isLocked;
	}

	public void setLocked(boolean isLocked) {
		this.isLocked = isLocked;
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getDesc() {
		return desc;
	}

	public void setDesc(String desc) {
		this.desc = desc;
	}

	public int getMissionIconRes() {
		// int res = -1;
		int res = 0;

		// switch (id) {
		// case ADVANCED_TASK:
		// // 高级任务
		// res = R.drawable.setting_bg_advanced_down_selector;
		// break;
		// case INTERMEDIATE_TASK:
		// // 中极任务
		// res = R.drawable.setting_bg_intermediate_down_selector;
		// break;
		// case NEW_USER_TASK:
		// // 新手任务
		// res = R.drawable.setting_bg_novice_down_selector;
		// break;
		// case PRIMARY_TASK:
		// // 初级任务
		// res = R.drawable.setting_bg_primary_down_selector;
		// break;
		// case X_TASK:
		// // X 任务
		// res = R.drawable.setting_bg_xmission_down_selector;
		// break;
		// }
		return res;
	}

	public String getStatus() {
		return status;
	}

	public void setStatus(String status) {
		this.status = status;
	}

	public String getTask_step_id() {
		return task_step_id;
	}

	public void setTask_step_id(String task_step_id) {
		this.task_step_id = task_step_id;
	}

	public String getStep_title() {
		return step_title;
	}

	public void setStep_title(String step_title) {
		this.step_title = step_title;
	}

	public String getStep_award_desc() {
		return step_award_desc;
	}

	public void setStep_award_desc(String step_award_desc) {
		this.step_award_desc = step_award_desc;
	}

	public String getAddgold() {
		return addgold;
	}

	public void setAddgold(String addgold) {
		this.addgold = addgold;
	}

	public String getAddjindou() {
		return addjindou;
	}

	public void setAddjindou(String addjindou) {
		this.addjindou = addjindou;
	}

	public String getAddglamour() {
		return addglamour;
	}

	public void setAddglamour(String addglamour) {
		this.addglamour = addglamour;
	}

	public String getAddexp() {
		return addexp;
	}

	public void setAddexp(String addexp) {
		this.addexp = addexp;
	}

	public String getRedirect() {
		return redirect;
	}

	public void setRedirect(String redirect) {
		this.redirect = redirect;
	}

	public String getTask_detail() {
		return task_detail;
	}

	public void setTask_detail(String task_detail) {
		this.task_detail = task_detail;
	}

	public String getTask_require() {
		return task_require;
	}

	public void setTask_require(String task_require) {
		this.task_require = task_require;
	}

	public boolean isStep_activity() {
		return step_activity;
	}

	public void setStep_activity(boolean step_activity) {
		this.step_activity = step_activity;
	}

	public String getStep_task_detail() {
		return step_task_detail;
	}

	public void setStep_task_detail(String step_task_detail) {
		this.step_task_detail = step_task_detail;
	}

	public int getStep_difficulty() {
		return step_difficulty;
	}

	public void setStep_difficulty(int step_difficulty) {
		this.step_difficulty = step_difficulty;
	}

	public boolean showReward(String reward) {
		if (ALNumericUtils.parseInt(reward, 0) > 0) {
			return true;
		}
		return false;
	}

	public String getTask_name() {
		return task_name;
	}

	public void setTask_name(String task_name) {
		this.task_name = task_name;
	}

	public String getTask_id() {
		return task_id;
	}

	public void setTask_id(String task_id) {
		this.task_id = task_id;
	}

	public String getTask_status() {
		return task_status;
	}

	public void setTask_status(String task_status) {
		this.task_status = task_status;
	}

	public String getTask_award_desc() {
		return task_award_desc;
	}

	public void setTask_award_desc(String task_award_desc) {
		this.task_award_desc = task_award_desc;
	}

	public void setAddpoints(String addpoints) {
		this.addpoints = addpoints;
	}

	public String getAddpoints() {
		return addpoints;
	}

	public void setInvite_redirect(String invite_redirect) {
		this.invite_redirect = invite_redirect;
	}

	public String getInvite_redirect() {
		return invite_redirect;
	}

	public String getInvite_type() {
		return invite_type;
	}

	public void setInvite_type(String invite_type) {
		this.invite_type = invite_type;
	}

	public String getInvite_sum() {
		return invite_sum;
	}

	public void setInvite_sum(String invite_sum) {
		this.invite_sum = invite_sum;
	}

	public void setInviteList(ArrayList<MissionInvite> inviteList) {
		this.inviteList = inviteList;
	}

	public ArrayList<MissionInvite> getInviteList() {
		return inviteList;
	}

	public class MissionInvite {
		private String invite_type;
		private String invite_redirect;
		private InviteType inviteType;

		public void setInvite_redirect(String invite_redirect) {
			this.invite_redirect = invite_redirect;
		}

		public String getInvite_redirect() {
			return invite_redirect;
		}

		public String getInvite_type() {
			return invite_type;
		}

		public void setInvite_type(String invite_type) {
			this.invite_type = invite_type;
			setInviteType(invite_type);
		}

		public InviteType getInvite_Type() {
			return inviteType;
		}

		public void setInviteType(String type) {
			if ("wechat".equals(type)) {
				// 微信
				inviteType = InviteType.INVITE_TYPE_WECHAT;
			} else if ("microblog".equals(type)) {
				// 微博
				inviteType = InviteType.INVITE_TYPE_MICRO_BLOG;
			} else if ("note".equals(type)) {
				// 短信
				inviteType = InviteType.INVITE_TYPE_NOTE;
			}
		}
	}

	public void setComplete(int complete) {
		this.complete = complete;
	}

	public int getComplete() {
		return complete;
	}
	
	

	/**
	 * @return the giftId
	 */
	public String getGiftId() {
		return giftId;
	}

	/**
	 * @param giftId the giftId to set
	 */
	public void setGiftId(String giftId) {
		this.giftId = giftId;
	}

	/**
	 * @return the giftName
	 */
	public String getGiftName() {
		return giftName;
	}

	/**
	 * @param giftName the giftName to set
	 */
	public void setGiftName(String giftName) {
		this.giftName = giftName;
	}

	/**
	 * @return the fileId
	 */
	public String getFileId() {
		return fileId;
	}

	/**
	 * @param fileId the fileId to set
	 */
	public void setFileId(String fileId) {
		this.fileId = fileId;
	}



	public enum InviteType {
		INVITE_TYPE_WECHAT, INVITE_TYPE_MICRO_BLOG, INVITE_TYPE_NOTE
	}
}
